﻿@model RawHtml
@{
    // add js/css
    Html.AddToBackEndContent("~/Areas/ProggyCore/Content/Scripts/Proggy.CorePropertyTypes.js", BackEndContentType.JavaScript);
    Html.AddToBackEndContent("~/Areas/ProggyCore/Content/Scripts/Proggy.CorePropertyTypes.DragAndDrop.js", BackEndContentType.JavaScript);
    Html.AddToBackEndContent("~/Areas/ProggyCore/Content/Scripts/Proggy.CorePropertyTypes.RawHtml.js", BackEndContentType.JavaScript);
    Html.AddToBackEndContent("~/Areas/ProggyCore/Content/ThirdParty/CodeMirror-2.33/lib/codemirror.css", BackEndContentType.Stylesheet);
    Html.AddToBackEndContent("~/Areas/ProggyCore/Content/ThirdParty/CodeMirror-2.33/lib/codemirror.js", BackEndContentType.JavaScript);
    Html.AddToBackEndContent("~/Areas/ProggyCore/Content/ThirdParty/CodeMirror-2.33/mode/xml/xml.js", BackEndContentType.JavaScript);
    Html.AddToBackEndContent("~/Areas/ProggyCore/Content/ThirdParty/CodeMirror-2.33/mode/javascript/javascript.js", BackEndContentType.JavaScript);
    Html.AddToBackEndContent("~/Areas/ProggyCore/Content/ThirdParty/CodeMirror-2.33/mode/css/css.js", BackEndContentType.JavaScript);
    Html.AddToBackEndContent("~/Areas/ProggyCore/Content/ThirdParty/CodeMirror-2.33/mode/htmlmixed/htmlmixed.js", BackEndContentType.JavaScript);
    Html.AddToBackEndContent("~/Areas/ProggyCore/Content/ThirdParty/CodeMirror-2.33/lib/util/formatting.js", BackEndContentType.JavaScript);
    Html.AddToBackEndContent("~/Areas/ProggyCore/Content/Css/RawHtml.css", BackEndContentType.Stylesheet);
    Html.RenderBackEndContentForLightboxPartial();

    // get unique id
    var unique = Model.GetUniqueElementId("rhtml", "rhtml");
}
<div class="rhtml" id="@unique">
    @Html.Hidden(Model.PropertyNameStart + ".TheHtml", Model.TheHtml)
    @*<textarea style="display: none;">@Html.Raw(HttpUtility.HtmlDecode(Model.TheHtml))</textarea>*@
    <textarea id="@Model.GetUniqueElementId("rhtml2","rhtml2")"></textarea>
</div>
<script type="text/javascript">

    Proggy.Static.WaitForTypesToRegister(function () {

        // get Object
        var rawHtmlObj = new Proggy.CorePropertyTypes.RawHtml();

        // init
        rawHtmlObj.Init("@unique");

    });
</script>
